﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupSignatureDeparture.aspx.cs" Inherits="MTRC.ODMS.Web.SOM.Popup.PopupSignatureDeparture" %>
<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls" TagPrefix="APJ" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <base target="_self" /><!--only _self can close the window, when had signature pic, then clear, it can close the form correctly-->
    <!--base target="_parent"-->
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" /> 
    <script type="text/jscript">
        var pageID;
        function Init()
        {
            //debugger;
            
            var url = window.parent.location.href;
            pageID=getQueryString(url, "rgb_array")
            var id;
            if(pageID == "")
            {
                window.returnValue='0';
            }
            else
            {
                window.returnValue='1';
            }
            
            var isReadOnly = "";
            isReadOnly = getQueryString(url, "isReadOnly");
//huangyao 20090122 fixed TD:1156
//            if(isReadOnly == "true")
//            {
//                var btnClearCtl = document.getElementById("btnClear");
//                if(btnClearCtl != null)
//                {
//                    btnClearCtl.disabled = true;
//                }
//            }
//--------//huangyao 20090122 fixed TD:1156
            
            var eventSignType = "";
            eventSignType = getQueryString(url, "eventSignType");
            //hdnEventSignType
            var hdnEventSignTypeCtl = document.getElementById("hdnEventSignType");
            if(hdnEventSignTypeCtl != null)
            {
                //document.getElementById("hdnEventSignType").value = eventSignType;
                hdnEventSignTypeCtl.value = eventSignType;
                //__doPostBack(document.getElementById("btnClear").id, "")
            }
        }
    
        function getQueryString(urlStr, name) 
		{
            var url = urlStr; //window.location.href;
            var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i"); 
            var id = ""
            if(reg.test(url)) 
            {
                id = unescape(RegExp.$2.replace(/\+/g, " "));
            }
            return id
        }
    
    //judge whether or not sigunature, but it can not work
    function SetOpenerValue()
    {
//        //window.dialogArguments.location = 'PopupContainer.htm';
////        window.dialogArguments.location = 'PopupSignatureContainer.htm';
////        var var1 = window.opener;
////        var var2 = window.dialogArguments.dialogArguments;
////        var var4 = window.parent.parent;
////        var var5 = window.parent.parent.parent;
////        var var6 = window.parent.parent.parent.parent;
//        //window.dialogArguments.CloseThisForm();
//        //window.parent.close();
////        var hdnForRefresh = window.parent.document.getElementById("ucSignature_hdnForRefresh");
////        hdnForRefresh.value = hdnTempValue.value;
//        
//        //window.opener.form1.txtSignFileName.value = hdnTempValue.value;
//        //var pForm = window.dialogArguments.form1;
//        //pForm.hdnForRefresh.value = hdnTempValue.value;
//        

//        
////        if(document.getElementById("hdnTempValue").value == "")
////        {
////            window.returnValue='0';
////        }
////        else
////        {
////            window.returnValue='1';
////        }

////        var hdnForRefresh = pForm.document.getElementById("hdnForRefresh");
////        hdnForRefresh.value = hdnTempValue.value;
//        //window.opener.__doPostBack(pForm.txtSignFileName.id, "");
//        //window.close();
    }				

    var FLASHBTNSAVETEXT = '<%=this.GetLabel("COM_Confirm")%>';
    //alert(BTNSAVETEXT);
    var FLASHBTNCLEARTEXT = '<%=this.GetLabel("SOM_SignType_ClearOrignalSignPic")%>';
    var FLASHFILESAVINGERRORMSG = '<%=this.GetMessage("SOM_SignatureFileSaveErrorMsg")%>';
    </script>
</head>
<body onload="Init();" onunload="SetOpenerValue();">
    <form id="form1" runat="server">
    <div>
        <table cellpadding="0" cellspacing="0" width="100%" >
            <tr>
                <td>
                    <asp:Panel ID="pnlSignatureArea" runat="server" Width="100%">
                        <!--input type="button" title="Close" value="Close" onclick="SetDialogParentFormValue();" /-->
                        <script type="text/javascript" src="../../Javascript/SOM/Signture_painting_Departure.js"></script>
                        <INPUT id="hdnTempValue" type="hidden" name="hdnTempValue" value="" runat="server" />
                        <INPUT id="hdnSignatureFullFileName" type="hidden" name="hdnSignatureFullFileName" value="" runat="server" /> <%--//huangyao 20090122 fixed TD:1156--%>
                        <INPUT id="hdnEventSignType" type="hidden" name="hdnEventSignType" value="" runat="server" /> <%--//huangyao 20090122 fixed TD:1156--%>
                    </asp:Panel>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Panel ID="pnlSignaturePic" runat="server" Width="100%" Direction="RightToLeft">
                        <asp:Image ID="imgSignaturePic" runat="server" style="border-width:1px; border-color:Black;" Width="250px" Height="150px" />
                        <asp:Button ID="btnClear" runat="server" Text="Clear" OnClick="btnClear_Click" Visible="false" /> <%--//huangyao 20090122 fixed TD:1156--%>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
